﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace skvote
{
    public partial class admin_userinfo : System.Web.UI.Page
    {
        private OleDbConnection connection = new conn().CreateConnection();
        protected void Page_Load(object sender, EventArgs e)
        {
            function.check();
            if (Request["id"] != null && Request["id"] != string.Empty)
            {
                function.IsNumberOrEmpty(Request["id"]);
                BindData("SELECT [name],[sex],[IdCard],[Tel],[Address],[Email],[Content] FROM XH_UserInfo WHERE [id]=" + Request["id"].Trim());
            }
        }
        private void BindData(string sql){
            try
            {
                OleDbCommand OleCmd = new OleDbCommand(sql, connection);
                OleDbDataReader OleDr = OleCmd.ExecuteReader();
                DataTable dt = new DataTable();
                DataColumn FirstColumn = dt.Columns.Add("FirstColumn",System.Type.GetType("System.String"));
                DataColumn SecondColumn = dt.Columns.Add("SecondColumn",System.Type.GetType("System.String"));               
                while (OleDr.Read())
                {
                    dt.Rows.Add(new object[] {"姓名:",OleDr.GetString(0)});
                    dt.Rows.Add(new object[] {"性别:", OleDr.GetString(1)});
                    dt.Rows.Add(new object[] {"身份证号码:", OleDr.GetString(2)});
                    dt.Rows.Add(new object[] { "电话:", OleDr.GetString(3) });
                    dt.Rows.Add(new object[] { "地址:", OleDr.GetString(4) });
                    dt.Rows.Add(new object[] { "邮箱:", OleDr.GetString(5) });
                    dt.Rows.Add(new object[] { "备注:", OleDr.GetString(6) });
                }
                table1.DataSource = dt;
                table1.DataBind();
            }
            finally
            {
                connection.Close();
            }
        }
    }
}
